package com.winshare.saleAssistant.domain.dto.req;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import java.util.List;

@ApiModel
public class ArticleQueryDTO {

    @ApiModelProperty(value = "栏目主键")
    private Integer articleModuleId;

    @Length(min = 0, max = 100, message = "栏目名称长度需要在1-100个字之间")
    @ApiModelProperty(value = "栏目名称")
    private String articleModuleName;

    @Length(min = 0, max = 100, message = "文章标题长度需要在1-100个字之间")
    @ApiModelProperty(value = "文章标题")
    private String articleTitle;

    @Range(min = 1, max = 5, message = "状态：1,草稿;2,审核中;3,已驳回;4,审核通过")
    @ApiModelProperty(value = "状态：1,草稿;2,审核中;3,已驳回;4,审核通过")
    private Integer status;

    @NotNull(message = "仅看我的：1,是;0,否")
    @Range(min = 0,max = 1,message = "仅看我的：1,是;0,否")
    @ApiModelProperty(value = "仅看我的：1,是;0,否")
    private Integer isMe;

    @Length(min = 0, max = 100, message = "地点长度需要在0-100个字之间")
    @ApiModelProperty(value = "地点")
    private String address;

    @NotNull(message = "每页数量不能为空")
    @Range(min = 1)
    @ApiModelProperty(value = "每页数量，建议10-20")
    private Integer pageSize;

    @NotNull(message = "第几页 字段为能为空")
    @Range(min = 1)
    @ApiModelProperty(value = "第几页，从1开始")
    private Integer pageIndex;

    @ApiModelProperty(value = "标签")
    private String articleLabel;

    @ApiModelProperty(value = "标签列表")
    private List<String> articleLabelList;

    @JsonIgnore
    @ApiModelProperty(hidden = true)
    public Integer getOffsetIndex() {
        return pageSize * (pageIndex < 1 ? 0 : pageIndex-1);
    }
    public ArticleQueryDTO() {
    }

    public Integer getArticleModuleId() {
        return articleModuleId;
    }

    public void setArticleModuleId(Integer articleModuleId) {
        this.articleModuleId = articleModuleId;
    }

    public String getArticleModuleName() {
        return articleModuleName;
    }

    public void setArticleModuleName(String articleModuleName) {
        this.articleModuleName = articleModuleName;
    }

    public String getArticleTitle() {
        return articleTitle;
    }

    public void setArticleTitle(String articleTitle) {
        this.articleTitle = articleTitle;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
    }

    public Integer getIsMe() {
        return isMe;
    }

    public void setIsMe(Integer isMe) {
        this.isMe = isMe;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getArticleLabel() {
        return articleLabel;
    }

    public void setArticleLabel(String articleLabel) {
        this.articleLabel = articleLabel;
    }

    public List<String> getArticleLabelList() {
        return articleLabelList;
    }

    public void setArticleLabelList(List<String> articleLabelList) {
        this.articleLabelList = articleLabelList;
    }
}
